<html lang="zh-cn">
<body>
<div id="popups-form-box">
    <div class="popups-window">
        <form>
            <a class="close" href="#">X</a>
            <span class="title">删除分类</span>
            <div class="main">
                <span>确定要删除[[${novelGroup.name}]]吗，此操作不可撤销？</span>
            </div>
            <div class="button-box">
                <input type="submit" value="确定">
                <a class="no" href="#">关闭</a>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    $(function () {
        // 监听关闭按钮
        $('#popups-form-box > .popups-window > form > .close').click(function (e) {
            e.preventDefault();
            $('#popups-box').hide();
            window.location.reload();
        });
        $('#popups-form-box > .popups-window > form > .button-box > .no').click(function (e) {
            e.preventDefault();
            $('#popups-box').hide();
            window.location.reload();
        });

        // 监听表单提交
        $('#popups-form-box > .popups-window > form').submit(function () {
            // 提交数据
            $('#popups-form-box .main').html(`<span>数据提交中...</span>`);
            $.ajax({
                url: 'novel_group/' + '[[${novelGroup.id}]]',
                type: "DELETE",
                success: function (res) {
                    $('#popups-form-box input[type="submit"]').remove();
                    $('#popups-form-box .main').html(res);
                }
            });

            return false;
        });

    });
</script>
</body>
</html>